package com.htfg.cardActivate.core;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @Auther: 王晨缘
 * @Date: 2018/10/24 0024 13:35
 * @Description:
 */
@ApiModel(value = "返回说明")
@Data
public class ResultData<T> {
    @ApiModelProperty(value = "返回状态码；200:成功")
    private int code;

    @ApiModelProperty(value = "描述信息")
    private String message;

    private T data;

    public ResultData(){}
    public ResultData(int code,String message,T data){
        this.code=code;
        this.message=message;
        this.data=data;
    }

    public static ResultData successDate(Object data){
        return new ResultData(ResultCode.SUCCESS.getCode(),ResultCode.SUCCESS.getMsg(),data);
    }
    public static ResultData failDate(int code,String msg,Object data){
        return new ResultData(code,msg,data);
    }
    public static ResultData failDate(Object data){
        return new ResultData(ResultCode.FAIL.getCode(),ResultCode.FAIL.getMsg(),data);
    }
}
